<!--- <script type="text/javascript">
	$(function(){

		if (loadTemplate("list", "usersListTemplate")) {
			$("#usersList").kendoListView({
				dataSource: users,
				template: kendo.template($("#usersListTemplate").html()),
				dataBound: function(e) {
					if (this.dataSource.total() == 0) {
						$("#usersTable").hide();
						$("#usersTableNoRecs").show();
					} else {
						$("#usersTable").show();
						$("#usersTableNoRecs").hide();
					}
				}
			});
		}
		if (loadTemplate("list", "sitesListTemplate")) {
			$("#sitesList").kendoListView({
				dataSource: sites,
				template: kendo.template($("#sitesListTemplate").html()),
				dataBound: function(e) {
					if (this.dataSource.total() == 0) {
						$("#sitesTable").hide();
						$("#sitesTableNoRecs").show();
					} else {
						$("#sitesTable").show();
						$("#sitesTableNoRecs").hide();
					}
				}
			});
		}
		/*if (loadTemplate("list", "oapsListTemplate")) {
			$("#oapsList").kendoListView({
				dataSource: oaps,
				template: kendo.template($("#oapsListTemplate").html()),
				dataBound: function(e) {
					if (this.dataSource.total() == 0) {
						$("#oapsTable").hide();
						$("#oapsTableNoRecs").show();
					} else {
						$("#oapsTable").show();
						$("#oapsTableNoRecs").hide();
					}
				}
			});
		}*/
		get("organization", authUser.organizationId, "detail", "inline");
		
		if (authUser.oapId == 0) {
			get("oap", 0, "edit", "modal");
		}
		if (authUser.paId == 0) {
			setTimeout(function() {
				get("pa", 0, "edit", "modal");
			}, 300);
		}
		
	})
</script> --->
<div class="row">
	<div class="banner prepare-banner">
		<div class="banner-text">
			<span class="banner-header">Welcome!</span><br />
			<span class="banner-subheader">2012-2013 Cash for College workshop season</span>
		</div>
	</div>
</div>
<div class="row content">
	<div class="span12">
		
		<!--- <section id="pa">
			<h3>Partnership Agreement</h3>
			<p><a class="btn btn-success" onclick="get('pa', 0, 'edit', 'modal')">Accept Partnership Agreement</a></p>
		</section> --->
		
		<!--- <section id="oap">
			<h3>Outreach Action Plan</h3>
			<p><a class="btn btn-success" onclick="get('oap', 0, 'edit', 'modal')">Create Outreach Action Plan</a></p>
			
			<!--- <table id="oapsTable" class="table table-hover table-bordered" style="display: none;">
				<thead>
					<tr>
						<th>ID</th>
						<th>Workshop Count</th>
						<th>Total Student Count</th>
						<th></th>
					</tr>
				</thead>
				<tbody id="oapsList">
					<tr>
						<td colspan="6">Loading...</td>
					</tr>
				</tbody>
			</table>
			<div id="oapsTableNoRecs" class="well well-small" style="display: none;">No Outreach Action Plans</div> --->

		</section> --->
		
		<section id="welcome">
			<h3>Before You Begin</h3>
			<p>Welcome to the 2012-13 program year for the Cash for College workshop series.  Before you begin registering your workshops, please confirm your organization, sites and users on this page.</p>
		</section>
		
		<section id="organization">
			<cfscript>
				organizationGatway = new assets.calgrants.com.gateway.OrganizationGateway();
				organization = organizationGateway.get(Organization_ID = request.authUser.organizationID);
			</cfscript>
			<h3>Organization</h3>
			<p>Please verify your organization's information below.</p>
			
			<cfoutput>
				<p>
					#organization.getOrganization()#<br />
					#organization.getAddress()#<br />
					#organization.getCity()#, CA #organization.getZip_Code()#
				</p>
				<p><a class="btn btn-success" href="?view=editOrganization&returnView=init&organizationID=#request.authUser.organizationID#">Edit Organization</a></p>
			</cfoutput>

		</section>
		
		<section id="users">
			<cfscript>
				userGateway = new assets.calgrants.com.gateway.UserGateway();
				users = userGateway.query(Organization_ID = request.authUser.organizationID);
			</cfscript>
			<h3>Users</h3>
			<p><a href="?view=editUser&returnView=init&userID=0" class="btn btn-success">New User</a></p>
			
			<table id="usersTable" class="table table-hover table-bordered">
				<thead>
					<tr>
						<th>Name</th>
						<!--- <th>Title</th> --->
						<th>Role</th>
						<th>E-mail</th>
						<th>Phone</th>
						<th>Status</th>
						<th></th>
					</tr>
				</thead>
				<tbody>
					<cfoutput query="users">
						<tr>
							<td>#First_Name# #Last_Name#</td>
							<td>#Role#</td>
							<td>#Email#</td>
							<td>#Phone#<cfif Len(Trim(Extension)) gt 0> x #Extension#</cfif></td>
							<td>
								<cfif Approved>
									Approved
								<cfelseif NOT Approved>
									Pending Approval
								</cfif>
							</td>
							<td><a href="?view=editUser&returnView=init&userID=#User_ID#">Edit</a></td>
						</tr>
					</cfoutput>
				</tbody>
			</table>

		</section>
		
		<section id="sites">
			<cfscript>
				siteGateway = new assets.calgrants.com.gateway.SiteGateway();
				sites = siteGateway.query(Organization_ID = request.authUser.organizationID);
			</cfscript>
			<h3>Sites</h3>
			<p><a href="?view=editSite&returnView=init&siteID=0" class="btn btn-success">New Site</a></p>
			
			<cfif sites.RecordCount gt 0>
			<table id="sitesTable" class="table table-hover table-bordered">
				<thead>
					<tr>
						<th>Site</th>
						<th>Site Type</th>
						<th>Address</th>
						<th>City</th>
						<th>Zip Code</th>
						<th>County</th>
						<th>Computers</th>
						<th></th>
					</tr>
				</thead>
				<tbody>
					<cfoutput query="users">
						<tr>
							<td>#Site#</td>
							<td>#Site_Type#</td>
							<td>#Address#</td>
							<td>#City#</td>
							<td>#Zip_Code#</td>
							<td>#County#</td>
							<td>#Computers#</td>
							<td><a href="?view=editSite&returnView=init&siteID=#Site_ID#">Edit</a></td>
						</tr>
					</cfoutput>
				</tbody>
			</table>
			<cfelse>
				<div id="sitesTableNoRecs" class="well well-small">No sites</div>
			</cfif>
			
			
		</section>
		
		<section id="next">
			<h3>Register Workshops</h3>
			<p>Now that you have reviewed your organization, sites and users you can begin to register your workshops.</p>
			
			<p><a class="btn btn-success" href="?view=workshops">Register Workshops</a></p>
		</section>
		
	</div>
</div>